package com.java.dp.observe;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author lizhilong
 * @create 2019/12/10 17:56
 * @desc 定义抽象的观察主题
 */
public abstract class Subject {
    protected List<Observer> observers = new ArrayList<>();

    public void addObserver(Observer observer){
        observers.add(observer);
    }

    public void  removeObserver(Observer observer){
        observers.remove(observer);
    }

    public abstract void  notify(String message);
}
